﻿#include "mysocket.h"
#include <QDebug>

MySocket::MySocket()
{

}

MySocket::MySocket(int port)
{
    listen(QHostAddress::Any,port);
}

MySocket::~MySocket()
{

}

void MySocket::incomingConnection(qintptr handler)
{
    tcp_send_receive = new QTcpSocket;
    tcp_send_receive->setSocketDescriptor(handler);
    emit ReceiveMsg_peerAddress(tcp_send_receive->peerAddress().toString());
    mys = new MyThread(tcp_send_receive,this);
    connect(mys,SIGNAL(sendMsg(QString ,QString ,QString )),
            this,
            SLOT(resiveMsg(QString ,QString ,QString )));
    mys->start();
}

void MySocket::resiveMsg(QString type, QString username, QString password)
{
    emit  show_user_pass(type,username,password);
}


